package com.hqyj.cl.controller;

import com.github.pagehelper.PageInfo;
import com.hqyj.cl.pojo.User;
import com.hqyj.cl.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @description：
 * @author：cc
 * @date：2021/10/12 13:51
 */
@Controller
@RequestMapping("/user")
public class UserController {
    //自动装配
    @Autowired
    private UserService userService;

    //login
    @RequestMapping("/login")
    @ResponseBody
    public Map<String,String> login(User user){
        return userService.login(user);
    }

    //selectAllUser
    @RequestMapping("/selectAllUser")
    @ResponseBody
    public PageInfo<User> selectAllUser(int pageNum,int pageSize){
        if(pageNum == -1)
            pageNum = 1;
        return userService.selectAllUser(pageNum,pageSize);
    }

}
